Skip to content

[skip changelog] Only download required artifact in Windows Installer job of release workflows #2743

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2024
Merged

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Nov 3, 2024

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • [N/A] Tests for the changes have been added (for bug fixes / features)
  • [N/A] Docs have been added / updated (for bug fixes / features)
  • [N/A] UPGRADING.md has been updated with a migration guide (for breaking changes)
  • [N/A] configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

The project's nightly build and production release workflows generate a Windows Installer package of Arduino CLI. This is generated from the Windows x86-64 build, which is produced by a prior job. The builds are transferred between jobs by GitHub Actions workflow artifacts, one for each host architecture.

The create-windows-installer job that generates the Windows Installer package unnecessarily downloads all the build artifacts:

pattern: ${{ env.ARTIFACT_NAME }}-*

pattern: ${{ env.ARTIFACT_NAME }}-*

This, even though it only requires the Windows x86-64 artifact. In addition to being inefficient, this was problematic because the create-windows-installer job is running in parallel with the notarize-macos job, which modifies the macOS artifacts. In order to fix a bug in the workflow, the notarize-macos job was recently changed (#2732) to delete the non-notarized macOS artifacts after downloading them so that the job could replace those artifacts with the notarized builds:

- name: Remove non-notarized artifact
uses: geekyeggo/delete-artifact@v5
with:
name: ${{ env.ARTIFACT_NAME }}-${{ matrix.artifact.artifact-suffix }}

- name: Remove non-notarized artifact
uses: geekyeggo/delete-artifact@v5
with:
name: ${{ env.ARTIFACT_NAME }}-${{ matrix.artifact.artifact-suffix }}

This caused the create-windows-installer job's download of the macOS artifacts to fail when it attempted to download them after the time the parallel notarize-macos job had deleted them (but before the notarize-macos job had uploaded the artifacts again):

https://github.com/arduino/arduino-cli/actions/runs/11647407075/job/32432652767#step:3:56

Error: Unable to download artifact(s): Unable to download and extract artifact: Artifact download failed after 5 retries.

What is the new behavior?

The proposed solution is to configure the create-windows-installer job to only download the artifact it requires. This artifact is not modified by any parallel job so there is no danger of a conflict.

Does this PR introduce a breaking change, and is titled accordingly?

No breaking change.

Other information

In order to facilitate the review, I modified the workflows so that they would not publish a release (historically I would have performed a full release in my own fork to demonstrate such a proposal, but the workflows are now utterly hostile to testing by contributors due to the new Windows signing certificate system) and triggered a run of each:

"Publish Nightly Build" workflow

https://github.com/arduino/arduino-cli/actions/runs/11648945583

The generated Windows Installer artifact can be downloaded from the "Artifacts" section of the page.

"Release" workflow

https://github.com/arduino/arduino-cli/actions/runs/11648942575

In this run, the Windows Installer generation step failed spuriously due to the workflow not having been triggered by a tag as intended (I didn't want to push a tag to Arduino's repo so I configured the workflow to be triggered by the push event instead):

https://github.com/arduino/arduino-cli/actions/runs/11648942575/job/32435926970#step:5:37

  C:\actions-runner\_work\arduino-cli\arduino-cli\installer\cli.wxs(19): error CNDL0108: The Product/@Version attribute's value, 'git', is not a valid version.  Legal version values should look like 'x.x.x.x' where x is an integer from 0 to 65534. [C:\actions-runner\_work\arduino-cli\arduino-cli\installer\cli.wixproj]

However, you can see that the previously failing "Download artifacts" is now successful:

https://github.com/arduino/arduino-cli/actions/runs/11648942575/job/32435926970#step:3:1

… job of release workflows

The project's nightly build and production release workflows generate a Windows Installer package of Arduino CLI. This
is generated from the Windows x86-64 build, which is produced by a prior job. The builds are transferred between jobs by
GitHub Actions workflow artifacts, one for each host architecture.

Previously, the "create-windows-installer" job that generates the Windows Installer package unnecessarily downloaded all
the build artifacts, even though it only requires the Windows x86-64 artifact. In addition to being inefficient, this
was problematic because the "create-windows-installer" job is running in parallel with the "notarize-macos" job, which
modifies the macOS artifacts. In order to fix a bug in the workflow, the "notarize-macos" job was recently changed to
delete the non-notarized macOS artifacts after downloading them so that the job could replace those artifacts with the
notarized builds. This caused the "create-windows-installer" job's download of the macOS artifacts to fail when it
attempted to download them after the time the parallel "notarize-macos" job had deleted them (but before the
"notarize-macos" job had uploaded the artifacts again).

The solution to the problem is to configure the "create-windows-installer" job to only download the artifact it
requires. This artifact is not modified by any parallel job so there is no danger of a conflict.
@per1234 per1234 added os: windows Specific to Windows operating system topic: infrastructure Related to project infrastructure type: imperfection Perceived defect in any part of project topic: packaging Related to the release distribution package labels Nov 3, 2024
@per1234 per1234 requested review from cmaglie and umbynos November 3, 2024 07:03
@per1234 per1234 self-assigned this Nov 3, 2024
Copy link
Member

@cmaglie cmaglie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @per1234!

@cmaglie cmaglie merged commit 3b14b47 into arduino:master Nov 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os: windows Specific to Windows operating system topic: infrastructure Related to project infrastructure topic: packaging Related to the release distribution package type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants